package evaluation.results;

import java.io.File;

public class SizeDifferencewithEmpty {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String type = "training";
		
		File results = new File("/proj/dbNoBackup/pjbarrio/Experiments/Wrappers/QueryResults/" + type +"/");
		
		File Emptyresults = new File("/proj/dbNoBackup/pjbarrio/Experiments/Wrappers/QueryResultsEmpty/" + type +"/");

		File[] res = results.listFiles();
		
		long maxmindiff = Long.MIN_VALUE;
		
		String maxminfile = "";
		
		String maxminFolder = "";
		
		for (int i = 0; i < res.length; i++) {
			
			String folder = res[i].getName();
			
			File[] files = res[i].listFiles();
			
			File[] empty = new File(Emptyresults,folder).listFiles();
			
			long mindiff = Long.MAX_VALUE;
			
			boolean in = false;
			
			String minFile = "";
			
			for (int j = 0; j < empty.length; j++) {
				
				for (int k = 0; k < files.length; k++) {
					
					in = true;	
					
					long diff = files[k].length() - empty[j].length();
					
					if (diff < mindiff){
//						System.out.println(folder + "," + files[k].getName() + "," + empty[j].getName() + "," + diff + "," + cant);	
						mindiff = diff;
						minFile = files[k].getName();
					}
				}
				
			}
			
			if (in){
				System.out.println(mindiff);
				
				if (mindiff > maxmindiff){
					maxmindiff = mindiff;
					maxminfile = minFile;
					maxminFolder = folder;
				}
			}
			
		}
	
		System.out.println(maxmindiff + "," + maxminFolder + "," + maxminfile);

	}

}
